package cn.t.web.android;

import cn.t.annotation.Runtime;
import cn.t.facade.android.DeviceAndroidConfigFacade;
import cn.t.runtime.dto.AndroidConfigRequest;
import cn.t.vo.andriod.AndroidConfigVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 安卓配置设备端接口
 */
@Slf4j
@RestController
@RequestMapping("runtime")
@AllArgsConstructor
@Runtime
public class AndroidConfigController {

    private final DeviceAndroidConfigFacade deviceAndroidConfigFacade;

    /**
     * 拉取所有配置
     */
    @PostMapping("/config/pull")
    public AndroidConfigVO pull(@Validated @RequestBody AndroidConfigRequest request) {
        return this.deviceAndroidConfigFacade.pull(request.getMd5(), request.getImei());
    }

}

